package com.playball.lottery.customview;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.playball.lottery.R;
import com.playball.lottery.util.DefConstants;
import com.playball.lottery.util.JCUtil;
/**
 * 发起合买界面list
 * @author Administrator
 *
 */
public class FaQiHeMaiAdapter extends BaseAdapter implements DefConstants{

	private class MyViewHolder {
		TextView Ball_red;
		TextView Ball_blue;
		TextView Ball_money;
		ImageButton buttonClose;
		TextView playtype;
	}

	private class MyElvSelFive {
		TextView ball;
		TextView ball_money;
//		Button buttonClose;
		TextView playtype;
	}

	private class MyJcFoot {
		TextView hteam;
		TextView vteam;
		Button sbut;
		Button pbut;
		Button fbut;
//		Button buttonClose;
	}

	private ArrayList<HashMap<String, Object>> mAppList;
	private LayoutInflater mInflater;
	private Context mContext;
	private String[] keyString;
	private int[] valueViewID;
	private MyViewHolder myholder;
	private MyElvSelFive myElv;
	private MyJcFoot myFoot;

	private String str_hteam;
	private String str_vteam;
	private String str_sp;
	private int lotID;

	public FaQiHeMaiAdapter(ArrayList<HashMap<String, Object>> appList) {
		mAppList = appList;
	}

	public FaQiHeMaiAdapter(Context c, ArrayList<HashMap<String, Object>> appList, int resource, String[] from, int[] to ,int lotid) {
		mAppList = appList;
		mContext = c;
		lotID=lotid;
		mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		keyString = new String[from.length];
		valueViewID = new int[to.length];
		System.arraycopy(from, 0, keyString, 0, from.length);
		System.arraycopy(to, 0, valueViewID, 0, to.length);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// 双色球
		if (lotID==LOT_ID_SSQ) {
			if (convertView != null) {
				myholder = (MyViewHolder) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_ssqhemai_list, null);
				myholder = new MyViewHolder();
				myholder.Ball_red = (TextView) convertView.findViewById(valueViewID[0]);
				myholder.Ball_blue = (TextView) convertView.findViewById(valueViewID[1]);
				myholder.Ball_money = (TextView) convertView.findViewById(valueViewID[2]);
//				myholder.buttonClose = (ImageButton) convertView.findViewById(valueViewID[3]);
				myholder.playtype = (TextView) convertView.findViewById(valueViewID[4]);
				convertView.setTag(myholder);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball1 = (String) appInfo.get(keyString[0]);
				String ball2 = (String) appInfo.get(keyString[1]);
//				String ball3 = (String) appInfo.get(keyString[2]);
				String money = (String) appInfo.get(keyString[2]);//ball3
				int bid = (Integer) appInfo.get(keyString[3]);
				String playtype = (String) appInfo.get(keyString[4]);
				myholder.Ball_red.setText(ball1);
				myholder.Ball_blue.setText(ball2);
//				myholder.Ball_money.setText(ball3);
				myholder.Ball_money.setText((Integer.parseInt(money)/2)+"注"+money+"彩豆");
				myholder.playtype.setText("["+playtype+"]");
				// myholder.buttonClose.setImageDrawable(myholder.buttonClose.getResources().getDrawable(bid));
//				myholder.buttonClose.setOnClickListener(new lvButtonListener(position, myholder.buttonClose.getId()));
			}
			// 大乐透
		} else if (lotID==LOT_ID_DLT) {
			if (convertView != null) {
				myholder = (MyViewHolder) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_dlthemai_list, null);
				myholder = new MyViewHolder();
				myholder.Ball_red = (TextView) convertView.findViewById(valueViewID[0]);
				myholder.Ball_blue = (TextView) convertView.findViewById(valueViewID[1]);
				myholder.Ball_money = (TextView) convertView.findViewById(valueViewID[2]);
//				myholder.buttonClose = (ImageButton) convertView.findViewById(valueViewID[3]);
				myholder.playtype = (TextView) convertView.findViewById(valueViewID[4]);
				convertView.setTag(myholder);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball1 = (String) appInfo.get(keyString[0]);
				String ball2 = (String) appInfo.get(keyString[1]);
//				String ball3 = (String) appInfo.get(keyString[2]);
				String money = (String) appInfo.get(keyString[2]);//ball3
				int bid = (Integer) appInfo.get(keyString[3]);
				String playtype = (String) appInfo.get(keyString[4]);
				myholder.Ball_red.setText(ball1);
				myholder.Ball_blue.setText(ball2);
//				myholder.Ball_money.setText(ball3);
				myholder.Ball_money.setText((Integer.parseInt(money)/2)+"注"+money+"彩豆");
				myholder.playtype.setText("["+playtype+"]");
				// myholder.buttonClose.setImageDrawable(myholder.buttonClose.getResources().getDrawable(bid));
//				myholder.buttonClose.setOnClickListener(new lvButtonListener(position, myholder.buttonClose.getId()));
			}
			// 11选5  11运夺金 排列3 排列5 福彩3D 22选5
		} else if (lotID==LOT_ID_11X5|| lotID==LOT_ID_11YDJ|| lotID==LOT_ID_CQSSC
				|| lotID==LOT_ID_PL3 || lotID==LOT_ID_PL5
				|| lotID==LOT_ID_FC3D || lotID==LOT_ID_QXC
				|| lotID==LOT_ID_QLC) {
			if (convertView != null) {
				myElv = (MyElvSelFive) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_11x5hemai_listnum, null);
				myElv = new MyElvSelFive();
				myElv.ball = (TextView) convertView.findViewById(valueViewID[0]);
				myElv.ball_money = (TextView) convertView.findViewById(valueViewID[1]);
//				myElv.buttonClose = (Button) convertView.findViewById(valueViewID[2]);
				myElv.playtype = (TextView) convertView.findViewById(valueViewID[3]);
				convertView.setTag(myElv);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball = (String) appInfo.get(keyString[0]);
				String money = (String) appInfo.get(keyString[1]);
				int bid = (Integer) appInfo.get(keyString[2]);
				String playtype = (String) appInfo.get(keyString[3]);
				myElv.ball.setText(ball);
//				myElv.ball_money.setText(money);
				myElv.ball_money.setText((Integer.parseInt(money)/2)+"注"+money+"彩豆");
				myElv.playtype.setText("["+playtype+"]");
				// myElv.buttonClose.setBackgroundDrawable(myElv.buttonClose.getResources().getDrawable(bid));
//				myElv.buttonClose.setOnClickListener(new lvButtonListener(position, myElv.buttonClose.getId()));
			}
			// 竞彩足球
		} else if (lotID==LOT_ID_JCZQ) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcrx9xhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
//				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
//					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}
		} else if (lotID==LOT_ID_BD) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcrx9xhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
//				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
//					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}
		} else if (lotID==LOT_ID_JCLQ) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcbbxhhm_lb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.pbut.setVisibility(View.INVISIBLE);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
//				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					String strLQWF = (String) appInfo.get(keyString[5]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);

					if (strLQWF.equals("RFSF")) {
						myFoot.sbut.setText("主负");
						myFoot.fbut.setText("主胜");
					} else if (strLQWF.equals("SF")) {
						myFoot.sbut.setText("主负");
						myFoot.fbut.setText("主胜");
					} else if (strLQWF.equals("DXF")) {
						myFoot.sbut.setText("大分");
						myFoot.fbut.setText("小分");
					}
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.fbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.sbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
//					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}
			// 胜负彩
		} else if (lotID==LOT_ID_ZQ_SFC) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcrx9xhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
//				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
//				myFoot.buttonClose.setVisibility(View.INVISIBLE);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					// myFoot.buttonClose.setOnClickListener(new
					// jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}
		} else if (lotID==LOT_ID_ZQ_RX9) {

			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcrx9xhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
//				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
//				myFoot.buttonClose.setVisibility(View.INVISIBLE);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					// myFoot.buttonClose.setOnClickListener(new
					// jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}

		}
		return convertView;
	}

//	class lvButtonListener implements OnClickListener {
//		private int position;
//		private int btnId;
//
//		lvButtonListener(int pos, int id) {
//			position = pos;
//			btnId = id;
//		}
//
//		@Override
//		@SuppressWarnings("all")
//		public void onClick(View v) {
//			int vid = v.getId();
//			if (vid == btnId) {
//				removeItem(position);
//				if (mContext.getClass().equals(SsqxhlbActivity.class)) {
//					((SsqxhlbActivity) mContext).InitBaseAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(DltxhlbActivity.class)) {
//					((DltxhlbActivity) mContext).InitBaseAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(ElvSelFiveListActivity.class)) {
//					((ElvSelFiveListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(ElvYunDJListActivity.class)) {
//					((ElvYunDJListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(CQSSCListActivity.class)) {
//					((CQSSCListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(Pailie3ListActivity.class)) {
//					((Pailie3ListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(Pailie5ListActivity.class)) {
//					((Pailie5ListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(Fc3dListActivity.class)) {
//					((Fc3dListActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(N7xxhlbActivity.class)) {
//					((N7xxhlbActivity) mContext).initSimpleAdapter(mAppList);
//				}
//				if (mContext.getClass().equals(N7lxhlbActivity.class)) {
//					((N7lxhlbActivity) mContext).initSimpleAdapter(mAppList);
//				}
//			}
//		}
//	}

//	class jcButtonListener implements OnClickListener {
//		private int position;
//		private int btnId;
//
//		jcButtonListener(int pos, int id) {
//			position = pos;
//			btnId = id;
//		}
//
//		@Override
//		@SuppressWarnings("all")
//		public void onClick(View v) {
//			int vid = v.getId();
//			if (vid == btnId) {
//				if (mAppList.size() > 2) {
//					removeItem(position);
//					if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
//						((JcfootxhlbActivity) mContext).initBaseAdapter(mAppList);
//					} else if (mContext.getClass().equals(bdxhlbActivity.class)) {
//						((bdxhlbActivity) mContext).initBaseAdapter(mAppList);
//					} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {
//						((JcBasketballxhlbActivity) mContext).initBaseAdapter(mAppList);
//					}
//				} else {
//				}
//			}
//		}
//	}

	@Override
	public int getCount() {
		return mAppList.size();
	}

	@Override
	public Object getItem(int position) {
		return mAppList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

//	public void removeItem(int position) {
//		if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
////			((JcfootxhlbActivity) mContext).initBaseAdapter(mAppList);
//			JcfootxhlbActivity.initMoney();
//		} else if (mContext.getClass().equals(bdxhlbActivity.class)) {
////			((bdxhlbActivity) mContext).initBaseAdapter(mAppList);
//			bdxhlbActivity.initMoney();
//		} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {
////			((JcBasketballxhlbActivity) mContext).initBaseAdapter(mAppList);
//			JcBasketballxhlbActivity.initMoney();
//		}
//		//如果用户点击删除操作非常快,可能会有数组下标越界异常
////		Log.v("removeItem", "position= "+position);
////		Log.v("removeItem", "mAppList.size()= "+mAppList.size());
//		if(position>=mAppList.size()){
//			return;
//		}
//		mAppList.remove(position);
//		this.notifyDataSetChanged();
//	}

	public ArrayList<BallDTO> GetSsqList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball1 = (String) mAppList.get(i).get(keyString[0]);
			String ball2 = (String) mAppList.get(i).get(keyString[1]);
			String money = (String) mAppList.get(i).get(keyString[2]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setSsq_ball(ball1 + "-" + ball2 + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetDltList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball1 = (String) mAppList.get(i).get(keyString[0]);
			String ball2 = (String) mAppList.get(i).get(keyString[1]);
			String money = (String) mAppList.get(i).get(keyString[2]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setDlt_ball(ball1 + "-" + ball2 + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetElvList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball = (String) mAppList.get(i).get(keyString[0]);
			String money = (String) mAppList.get(i).get(keyString[1]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setElv_ball(ball + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetPl3List() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball = (String) mAppList.get(i).get(keyString[0]);
			String money = (String) mAppList.get(i).get(keyString[1]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setPl3_ball(ball + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<ChildDTO> GetFootList() {
		ArrayList<ChildDTO> newlist = new ArrayList<ChildDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String mId = (String) mAppList.get(i).get(keyString[0]);
//			String str_team = (String) mAppList.get(i).get(keyString[1]);
			String str_hteam = (String) mAppList.get(i).get(keyString[1]);
			String str_vteam = (String) mAppList.get(i).get(keyString[2]);
			String str_sp = (String) mAppList.get(i).get(keyString[3]);
			String str_time = (String) mAppList.get(i).get("tip_time");
//			 Log.v("DAda GetFootList", "mId= " + mId + " str_team= " +
//			 str_team + " str_sp= " + str_sp + " str_time= " + str_time);
			ChildDTO childdto = new ChildDTO();
			childdto.mId = mId;
//			childdto.str_team = str_team;
			childdto.hTeam = str_hteam;
			childdto.vTeam = str_vteam;
			childdto.str_sp = str_sp;
			childdto.eTime = str_time;
			newlist.add(childdto);
		}
		return newlist;
	}

	// 判断字符串是否有特点的字符
	static boolean containsAny(String str, String searchChars) {
		return str.contains(searchChars);
	}
}